#include<iostream>
#include "EquationSolver.h"
#include <cmath>  
using namespace std;

const double L = 10, r = 1, V = 12.4;

class Func : public Function{
public:
    double operator () (const double &h) {
        return L * ( 0.5 * M_PI * r * r - r * r * asin(h/r) - h * sqrt(r * r - h * h ) ) - V;
    }
    double diff (const double &h) {
        return L * ( - r * 1.0 / sqrt(1.0 - (h / r) * (h / r)) - sqrt(r * r - h * h ) + 2 * h * h / sqrt(r * r - h * h) );
    }
}func;

int main(){
    NewtonSolver(func, 0, 100).solve();
    BisectionSolver(func, 0, 1, eps, 100).solve();
    SecantSolver(func, 0, 0.5, eps, 100).solve();
    return 0;
}